import request from '@/utils/request'
import store from '@/store'

export function getStationInfos(id) {
  return request({
    url: '/linedata/stationInfos',
    method: 'get'
  })
}

export function getStationGeo() {
  return request({
    url: '/linedata/stationGeoData',
    method: 'get'
  })
}  

export function getStationMap() {
  return request({
    url: '/linedata/stationMapData',
    method: 'get'
  })
}  

// export function getStatus() {
//   return request({
//     url: '/dss/stationStatus_DSS',
//     method: 'get'
//   })
// }    


export function getDSS(id) {
    return request({
      url: '/dss/stationDSS',
      method: 'get',
      params: { stationNo: id }
    })
  }

export function TWS(id) {
    return request({
      url: '/tws-rt/TWS_Entitys',
      method: 'get',
      params: { deviceType: id }
    })
  }  

export function getStatus() {
    return request({
      url: '/dss/stationStatus_DSS',
      method: 'get'
    })
  }    

  export function postfencePoints(data) {
    return request({
      url: '/electric-fence/gps-points',
      method: 'post',
      data:data
    })
  }

export function postfenceTrack(data) {
    return request({
      url: '/electric-fence/track',
      method: 'post',
      data:data
    })
  }  

export function getFence(id) {
    return request({
      url: '/electric-fence/',
      method: 'get',
      params: { fence_id: id }
    })
  }   

export function getAllFence() {
    return request({
      url: '/electric-fence/all',
      method: 'get'
    })
  }     

export function putFence() {
    return request({
      url: '/electric-fence/',
      method: 'put'
    })
  }       

export function deleteFence() {
    return request({
      url: '/electric-fence/',
      method: 'delete'
    })
  }   

export function deleteAllFence() {
    return request({
      url: '/electric-fence/all',
      method: 'delete'
    })
  }     

  export function getStationTask() {
    if(store.getters.configJson && store.getters.configJson.noEvacuateState) {
      return request({
        url: '/task/taskBriefList',
        method: 'get',
        params: { state: [5] }
      })
    } else {
      return request({
        url: '/task/taskBriefList',
        method: 'get',
        params: { state: [5,6] }
      })
    }
  }    

  export function getTaskFence(id) {
    return request({
      url: '/task/taskBriefInfo',
      method: 'get',
      params: { taskId: id }
    })
  }     


  export function postPersonPosition(data) {
    return request({
      url: '/postperson/testPersonPosition',
      method: 'post',
      data:data
    })
  }  

  export function  postController(data) {
    return request({
      url: '/postperson/postController',
      method: 'post',
      data:data
    })
  }  


  export function  getHistoryPersonPosition(data) {
    return request({
      url: '/postperson/getPersonPosition',
      method: 'get',
      data:data
    })
  }  

  export function  startTraceReplay(data) {
    return request({
      url: '/postperson/startTraceReplay',
      method: 'post',
      data:data
    })
  }  


  export function getTrainPageInfos() {
    return request({
      url: '/device/getInfoList',
      method: 'GET',
  
    })
  }

  export function getLineData() {
    return request({
      url: '/linedata/getLineData',
      method: 'GET',
  
    })
  }

  export function getuserInfo(id) {
    return request({
      url: '/user/getInfo',
      method: 'get',
      params: { userId: id }
    })
  } 

  export function getUserInfoEncrypt(id) {
    return request({
      url: '/user/getInfoEncrypt',
      method: 'get',
      params: { userId: id }
    })
  }
    